package com.job.springSea.work0718;

import java.util.Random;
import java.util.Scanner;

/**
 * @author 于春海
 * @version 1.0
 * @since 2022-07-18 20:56:24
 */
public class lottery {
    public static void main(String[] args) {
        int[] lotteryNumber=new int[7];
        keepNumber(lotteryNumber);
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 5; i++) {
            System.out.println("请输入第"+(i+1)+"组彩票号码:");
            int[] raffle=new int[7];
            for (int j = 0; j < 7; j++) {
                raffle[j]=sc.nextInt();
            }
            int count=0;
            for (int j = 0; j < 7; j++) {
                for (int k = 0; k < 7; k++) {
                    if(raffle[j]==lotteryNumber[k]){
                        count++;
                    }
                }
            }
            if(count==7){
                System.out.println("该彩票中了特等奖!");
            } else if (count==6) {
                System.out.println("该彩票中了一等奖!");
            } else if (count==5) {
                System.out.println("该彩票中了二等奖!");
            }else if (count==4) {
                System.out.println("该彩票中了三等奖!");
            }else if (count==3) {
                System.out.println("该彩票中了四等奖!");
            }else if (count==2) {
                System.out.println("该彩票中了五等奖!");
            }else if (count==1) {
                System.out.println("该彩票中了六等奖!");
            }else if (count==0) {
                System.out.println("该彩票未中奖!");
            }
        }
        System.out.println("彩票号码:");
        for (int i = 0; i < 7; i++) {
            System.out.print(lotteryNumber[i]+"\t");
        }
    }

    private static void keepNumber(int[] lotteryNumber) {
        for (int i = 0; lotteryNumber[6]==0;) {
            Random r=new Random();
            int number=r.nextInt(33)+1;
            int j=0,count=0;
            for ( ; j <= i; j++) {
                if(number!=lotteryNumber[j]){
                    count++;
                }
            }
            if(count==i+1){
                lotteryNumber[i]=number;
                i++;
            }
        }

    }


}